﻿<?php
require_once('class.data.php');
class search
{
	
	function result($sql_table,$condition)
	{
		$db=new data_class;
		$sql='SELECT * FROM '.$sql_table.' WHERE '.$condition.' order by id desc';
		$res=$db->query($sql);//返回的具体数据
		return $res;
	}
	function title_beside($id)
	{
		$db=new data_class;
		$query ="SELECT id,title FROM nan_article WHERE id=".($id-1)." or id=".($id+1);
		$row=$db->query($query);
		if($row[0]->id==($id-1))
			$title_last="<a href=\"/html/php".($id-1).".html\" target=\"_blank\" style=\"color:#FF0000;\">".$row[0]->title."</a>";
		else
			$title_last='<A href=/html/php46.html target=_self  style="color:#FF0000;">PHP+Ajax实现用户注册的界面</A>'; 
		if($row[0]->id==($id+1))
			$title_next="<a href=\"/html/php".($id+1).".html\" target=\"_blank\" style=\"color:#FF0000;\">".$row[0]->title."</a>";
			else
				if($row[1]->id==($id+1))
					$title_next="<a href=\"/html/php".($id+1).".html\" target=\"_blank\" style=\"color:#FF0000;\">".$row[1]->title."</a>";
				else
					$title_next="<A href=/html/php46.html target=_blank style=\"color:#FF0000;\">PHP+Ajax实现用户注册的界面</A>"; 
		$r=array();
		$r[0]=$title_last;
		$r[1]=$title_next;
		return $r;
	}
}
?>
